package FreeCellDataStructures;

import java.util.Stack;
import FreeCellBackend.Card;


public class Foundation{
	private Stack<Card> foundation;
	
	public Foundation(){
		foundation = new Stack<Card>();
	}
	public boolean add(Card c){
		if(foundation.isEmpty() && c.getValue() == 1){
			foundation.push(c);
			return true;
		}
		if((foundation.peek().getSuite() == c.getSuite()) && (foundation.peek().getValue() + 1 == c.getValue())){
			foundation.push(c);
			return true;
		}
		return false;
	}
	public Card get(){
		return foundation.peek();
	}
}
